UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'PGypSN8oU+MwiWuFYu0RPxI4+xXSeXFNpC/uxe1lIvg=' 
WHERE 
  key_id = '7e7dc4a2238914da0fa25e3203d5acecd377156431bb0b4e421435c2b654d877' 
  AND (
    token = 'PGypSN8oU+MwiWuFYu0RPxI4+xXSeXFNpC/uxe1lIvg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021