UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '2r8y0kpV5ucuqHtgqQmRph63iCxZ2TrGK4DTwuXEFsM='
WHERE
key_id = '39d523e147ded09ee5184afc3146548bea4a5f57874b6442fbbe72ddfbaab9d1'
AND (
token = '2r8y0kpV5ucuqHtgqQmRph63iCxZ2TrGK4DTwuXEFsM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)