UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'OUfcf6ONmxNrGo2GdgaqT+KFxZ2w+ekrOIgQNak9egg='
WHERE
key_id = 'a195e8b3da4e626544f12942398034730a5a3215a58a1a9d098504e1e2adc029'
AND (
token = 'OUfcf6ONmxNrGo2GdgaqT+KFxZ2w+ekrOIgQNak9egg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)