UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'bSDEHvngRoqchtjLDLcG0BWqUFaZWPkSljWUPqcz8qI='
WHERE
key_id = 'd529c0ba28ae49dc16b9e6f16d820b3ea1b4b58a2471c64dbb74c0eececc20b0'
AND (
token = 'bSDEHvngRoqchtjLDLcG0BWqUFaZWPkSljWUPqcz8qI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)