UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8Pi0Pl5qNZHMT5vuQJEcxuV4sIyj4lwr2z4PineMjv8='
WHERE
key_id = 'b5446d58424a673680da1fb3d090f9dcb38da6f42db12e63772a56823944b3c7'
AND (
token = '8Pi0Pl5qNZHMT5vuQJEcxuV4sIyj4lwr2z4PineMjv8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)