UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'q6khDBZz3sc7/h7HwkrlAJyL1BUMn+tCEZVWzYOyeIM=' 
WHERE 
  key_id = 'a1bfdd1517af6ef638002dbf95902b74af45e7a52ff4086a1004ef63a1adc25c' 
  AND (
    token = 'q6khDBZz3sc7/h7HwkrlAJyL1BUMn+tCEZVWzYOyeIM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028