UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'loQgiCPutlTAPmxJoSDIW06+bSDt8Fb9S1krQkQxNfo='
WHERE
key_id = 'fc054f0e8d1e4fcd852a30fe68ab74a07be32cc005407c11e888211b5c288535'
AND (
token = 'loQgiCPutlTAPmxJoSDIW06+bSDt8Fb9S1krQkQxNfo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)