UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'lorLtgNWh8Y7EUPEmQ5yW5ceKc/o6GMQFYqHrDIowhM='
WHERE
key_id = '9f490f5a11814d64945efd0918bf3a932c671313b2d6ba15474c24c0bc519f6d'
AND (
token = 'lorLtgNWh8Y7EUPEmQ5yW5ceKc/o6GMQFYqHrDIowhM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)