UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Pv5/3tKJoFX2cqkAh6XNb6NDONYaeBOTAkKX0r2CC4U=' 
WHERE 
  key_id = 'f6d03234f9f69e1f3b51ffd91f93a979890a08f49e44586a42e33989ab42752f' 
  AND (
    token = 'Pv5/3tKJoFX2cqkAh6XNb6NDONYaeBOTAkKX0r2CC4U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027