UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'OVGrczdF5BzveHNvMEXL4e/zbjlo9e67igknZ7AcGp4='
WHERE
key_id = 'f176fa00998c7e213f64eb73d08345c045ccaec4082680aa189e8b07c6063a7e'
AND (
token = 'OVGrczdF5BzveHNvMEXL4e/zbjlo9e67igknZ7AcGp4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)