UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '883pPPigOBJbUPMkaIEnOBeCzjzmE+BbcarNdG+3MzE=' 
WHERE 
  key_id = '7e271e0de05a6ce381bad0e46052b494122c49580bd66df46c38dc59285c1f23' 
  AND (
    token = '883pPPigOBJbUPMkaIEnOBeCzjzmE+BbcarNdG+3MzE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036