UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'sFriO/Jbt20h0IrDfMYP6AkjTgbx1yQPbt7y13LyGIA='
WHERE
key_id = 'd8d4f8e546e73c94d160c769996d58e0e9da20df5c18ea82146deefa9bcdd7a1'
AND (
token = 'sFriO/Jbt20h0IrDfMYP6AkjTgbx1yQPbt7y13LyGIA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)