UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'h4QGwA5TECIEMeqmir12Hn9FAaxIugbAYmcWMWMOKMg='
WHERE
key_id = 'e0c7be1e17c495586fa7a8828a79ce52b29b8c0656ff793ea8b44bfda26b93cb'
AND (
token = 'h4QGwA5TECIEMeqmir12Hn9FAaxIugbAYmcWMWMOKMg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)