UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Zfcio40FyS0rzPdcWn7nNi1ItGfTZrANAOejcmcYtCw=' 
WHERE 
  key_id = '27b36146fc0d92546669774888fbfbe2358dfd2a73a608679f860b2bb12cc277' 
  AND (
    token = 'Zfcio40FyS0rzPdcWn7nNi1ItGfTZrANAOejcmcYtCw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031