UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'cQOyP7cNn0KvKRS2McI9qGz3C1GvolrRdZEKACF5rlM='
WHERE
key_id = '37863d7462d79ad9d5ea0875ee9f11cca36a28e6ac246ac951d0781a4c1653fb'
AND (
token = 'cQOyP7cNn0KvKRS2McI9qGz3C1GvolrRdZEKACF5rlM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)