UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'RZ99/fE0IwgSSSMwXVdnAjy7KjPp7YHDqHklcFS9wyk='
WHERE
key_id = '23bf1b7a4e7b905e4efb2d2f4c0e5d32563ccc62e422167e6cd3d935e4b3b50d'
AND (
token = 'RZ99/fE0IwgSSSMwXVdnAjy7KjPp7YHDqHklcFS9wyk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)