UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '7DkJlKuMP+mdhwzADa3AqwxcVnrGPV2X/OLi2XMimms='
WHERE
key_id = 'a0215beba0be7cffd11b995918bd6d378a58c5752d402be7d965df72e661af7b'
AND (
token = '7DkJlKuMP+mdhwzADa3AqwxcVnrGPV2X/OLi2XMimms='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)