UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '95cNI3xh1hNJLVv4hVUHm7yX+V6Ef2HLGTVdgXrbdDc=' 
WHERE 
  key_id = '75782c04c9187b3bfdb837935e329ae50391d75aad31de248de96793e4c79971' 
  AND (
    token = '95cNI3xh1hNJLVv4hVUHm7yX+V6Ef2HLGTVdgXrbdDc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045