UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0BhVN5XXOdbDDrDf2hVVCt6uvvrCn1a9qcNXxZg7i88='
WHERE
key_id = 'e7e6ff9e02ed0eff31bf23c2ce1f8a1d4b51a0a3dc6e8c59618d3ab0a3e788e3'
AND (
token = '0BhVN5XXOdbDDrDf2hVVCt6uvvrCn1a9qcNXxZg7i88='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)