UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 't41vwY9bHulCdjD+BfYhwJdkD4XXflkMoA+VdAGDVwE='
WHERE
key_id = 'd6ee161077c53ff0e1e1f71a78029d759ffebdde7cfa946c7ca98a039403b7dc'
AND (
token = 't41vwY9bHulCdjD+BfYhwJdkD4XXflkMoA+VdAGDVwE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)