UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'sQXdzmoCnlyz9IOSLrK7rXwNdBOQGdutWMNEwX0haAg='
WHERE
key_id = '3f239fcb09d473aea6d3aae58c4f0e5197159a99a41be343f7060ea4f4e3a834'
AND (
token = 'sQXdzmoCnlyz9IOSLrK7rXwNdBOQGdutWMNEwX0haAg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)