UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'sxaTiPv6Ykq8lkVtZ/osJdafSiktEDcN+mYF52FBqB4='
WHERE
key_id = 'd54f3c2c58e71716c504e283420254b24842c6809f9c1aaaf8156c7d9929457c'
AND (
token = 'sxaTiPv6Ykq8lkVtZ/osJdafSiktEDcN+mYF52FBqB4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)