UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '+ofgau3hiWqMVdbB2W/Un14/B1VrhDvcKYlQW6nwBf0='
WHERE
key_id = 'f5122e76bd8f03a1b365c945d2a589b0af2f86ef2afc6462f0230c969f749451'
AND (
token = '+ofgau3hiWqMVdbB2W/Un14/B1VrhDvcKYlQW6nwBf0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)