UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'owwt6cRE/rmxJjvUsgOsRM5TnKB/+MvL9EEEONibU2Y='
WHERE
key_id = 'b80e0c982b3e9321153fb859d16c69804053bd8f982cd5e5c2d1f6785149e318'
AND (
token = 'owwt6cRE/rmxJjvUsgOsRM5TnKB/+MvL9EEEONibU2Y='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)