UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Ay99kJwAC1LeGhbiIcESkzSdg3xclf0/ZYTgRjDcfvY='
WHERE
key_id = '5e55afbea8b3ebba08371ff779aa587be7464481f818f4971a3ef7ae54030a65'
AND (
token = 'Ay99kJwAC1LeGhbiIcESkzSdg3xclf0/ZYTgRjDcfvY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)