UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1NTsrCp1VPcUPQGp86U7uj3C0QrhdD76lVcDworY8xg=' 
WHERE 
  key_id = 'fc931d44664fedf33e27a0720361bfdfd507f899708d20d1226399aee269fe77' 
  AND (
    token = '1NTsrCp1VPcUPQGp86U7uj3C0QrhdD76lVcDworY8xg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023