UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TMbGlhZB6d2gHMMvlrTPGEQLMF0+64euyG+BuxdAJeg=' 
WHERE 
  key_id = 'd4d3765d310fc21ac40803a47d0fe43574d79fd92dfea11833bf4507f35ef4eb' 
  AND (
    token = 'TMbGlhZB6d2gHMMvlrTPGEQLMF0+64euyG+BuxdAJeg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039