UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'WkXIveadZFgZsUHQ9sTKUsT05ccI2jEDvbFb/HMCrMM='
WHERE
key_id = 'd9988690d4da2d466f403220e277229df6a17064ad0dd3cad0802a1ac93ef77e'
AND (
token = 'WkXIveadZFgZsUHQ9sTKUsT05ccI2jEDvbFb/HMCrMM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)