UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6U/xWlnAqcfrfGUh3MTwiLLDwh+IVij05FA8irnDd6Y='
WHERE
key_id = '694c47748318fe973d525bcb94100abc2228c7d8b250d92bff74f3b96bb350fa'
AND (
token = '6U/xWlnAqcfrfGUh3MTwiLLDwh+IVij05FA8irnDd6Y='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)