UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'wnG0RoiEUO0kjvEYipvQcyVdFOh64o+k/qrE2yT5v8U='
WHERE
key_id = '2ebef6fd16e90353c80cc0709f0e9fb1e0166015b4115f1df5a107006dae9ae1'
AND (
token = 'wnG0RoiEUO0kjvEYipvQcyVdFOh64o+k/qrE2yT5v8U='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)