UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5TotIBpBz77qOZFp4WlKT3rj75jnWd8ejrF21LsOwFA='
WHERE
key_id = '731bd3b30a8a20d9bf27f65395398817e44020e41c5821c461d8b635aa9e395c'
AND (
token = '5TotIBpBz77qOZFp4WlKT3rj75jnWd8ejrF21LsOwFA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)