UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'd6rYr8KQ6ASPc3K5kNIy0Dck4JJ947B8fIjAvD+HUX4=' 
WHERE 
  key_id = '5a17454d7c63b63024ccb947b7d1c4e2774a3f9c6dc7366ed683dd510d41036c' 
  AND (
    token = 'd6rYr8KQ6ASPc3K5kNIy0Dck4JJ947B8fIjAvD+HUX4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033