UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'y7XMCIZA9v/uPu3UOG8vJ32YgUXuuyoyce31uzrddBM='
WHERE
key_id = 'e77519228b732ab8b4d0824cad7d9ba19e1b37bed60e44c866b735ba5c3f7d1f'
AND (
token = 'y7XMCIZA9v/uPu3UOG8vJ32YgUXuuyoyce31uzrddBM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)