UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Z5AjjM+rJ8RfswbPA2pDUDzHNEmHmr5eoE+xms0DFf8='
WHERE
key_id = '86ba1b35bc947ea722574471f289878c9627b8cdbdad9d48344c4dc8e5d6bc37'
AND (
token = 'Z5AjjM+rJ8RfswbPA2pDUDzHNEmHmr5eoE+xms0DFf8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)